import mockRequests from './mockAjax'
import request from './request'
import qs from 'qs'

const baseUrl = "http://localhost:8080/api";


// 轮播图请求的假数据
export const reqGetBannerList = () => {
    return mockRequests({ url: '/banner', method: 'get' })
}

//用户登录
export const login = (data) => {
    return request({
        url: `${baseUrl}/userLogin`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 用户注册
export const register = (data) => {
    return request({
        url: `${baseUrl}/addUser`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 用户上传头像
export const uploadPage = (data) => {
    return request({
        url: `${baseUrl}/updateUserPage`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 用户充值钱包
export const charge = (data) => {
    return request({
        url: `${baseUrl}/addMoney`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 查看愿望单
export const wish = (data) => {
    return request({
        url: `${baseUrl}/getWish`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 修改个人信息
export const changeInfo = (data) => {
    return request({
        url: `${baseUrl}/setPerson`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 获取资讯
export const getNews = () => {
    return request({
        url: `${baseUrl}/getNew `,
        method: 'post',
    })
}

// 资讯详情
export const getNewsDetail = (data) => {
    return request({
        url: `${baseUrl}/inNew`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 点赞资讯
export const likeNews = (data) => {
    return request({
        url: `${baseUrl}/likeNew`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 发帖
export const postContent = (data) => {
    return request({
        url: `${baseUrl}/upContent`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 获得全部帖子
export const reqAllPostList = () => {
    return request({
        url: `${baseUrl}/getContentList`,
        method: 'post',
    })
}

// 点击帖子详情
export const reqPostDetail = (data) => {
    return request({
        url: `${baseUrl}/getContent`,
        method: 'post',
        data: qs.stringify(data)

    })
}

// 点赞帖子
export const likePost = (data) => {
    return request({
        url: `${baseUrl}/likeContent`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 跟帖
export const reply = (data) => {
    return request({
        url: `${baseUrl}/addFollowContent`,
        method: 'post',
        data: qs.stringify(data)
    })
}



// 点赞评论
export const likeComment = (data) => {
    return request({
        url: `${baseUrl}/likeFollowContent`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 发表的帖子
export const reqMyPostList = (data) => {
    return request({
        url: `${baseUrl}/getMyContentList`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 删除帖子
export const deletePost = (data) => {
    return request({
        url: `${baseUrl}/deletecontent`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 个人跟帖
export const reqMyComment = (data) => {
    return request({
        url: `${baseUrl}/getMyFollowContent`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 删除跟帖
export const reqdeleteComment = (data) => {
    return request({
        url: `${baseUrl}/deletefollowcontent`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 获取游戏购买信息
export const reqMygame = (data) => {
        return request({
            url: `${baseUrl}/getBuyGame`,
            method: 'post',
            data: qs.stringify(data)
        })
    }
    // 查看我的充值记录
export const reqMydeposit = (data) => {
    return request({
        url: `${baseUrl}/getMyAddMoney`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 查看我的游戏
export const reqGame = (data) => {
    return request({
        url: `${baseUrl}/getMyGame`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 点击进入游戏详情
export const reqGameDetail = (data) => {
    return request({
        url: `${baseUrl}/ingame`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 搜索框搜索
export const reqSelect = (data) => {
    return request({
        url: `${baseUrl}/findGame1`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 关键词搜索
export const reqKeySelect = (data) => {
    return request({
        url: `${baseUrl}/findGame2`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 畅销游戏
export const reqSaleBest = (data) => {
    return request({
        url: `${baseUrl}/orderBycount`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 评分排序游戏
export const reqGradeBest = (data) => {
    return request({
        url: `${baseUrl}/orderByavg`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 价格排序游戏
export const reqPriceGame = (data) => {
    return request({
        url: `${baseUrl}/orderBymoney`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 购买游戏
export const reqbuyGame = (data) => {
    return request({
        url: `${baseUrl}/buyGame`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 评测游戏
export const reqCommentGame = (data) => {
    return request({
        url: `${baseUrl}/gamecomment`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 获取游戏信息
export const reqGameInfo = () => {
    return request({
        url: `${baseUrl}/getNew`,
        method: 'post',
    })
}

// 获取游戏
export const reqGameList = () => {
    return request({
        url: `${baseUrl}/getGame`,
        method: 'post',
    })
}

// 增加个人心愿单
export const reqAddWish = (data) => {
    return request({
        url: `${baseUrl}/addWish`,
        method: 'post',
        data: qs.stringify(data)
    })
}

// 移除愿望单
export const reqRemoveWish = (data) => {
    return request({
        url: `${baseUrl}/deletewish`,
        method: 'post',
        data: qs.stringify(data)
    })
}